package merchants;

import buyers.Buyer;


import java.util.ArrayList;

public class MerchantDAOArrayList  {
    ArrayList<Merchant> merchantArrayList = new ArrayList<>();
    public boolean equal(String userName , String passWord){

        for (Merchant temp:merchantArrayList) {
            if(temp.getUserName().equals(userName)&&temp.getPassWord().equals(passWord)){
                return true;
            }
        }
        return false;
    }
    public void changePassWord(Object other){
        Merchant M = (Merchant)other;
        for(int i = 0 ; i < merchantArrayList.size() ; i ++ ){
            if(M.getUserName().equals(merchantArrayList.get(i).getUserName())){
                merchantArrayList.remove(i);
                merchantArrayList.add(M);
            }
        }

    }

    public boolean addAccountData(Object other) {
        Merchant M = (Merchant)other;
        merchantArrayList.add(M);
        return true;
    }

    public ArrayList<Merchant> getMerchantArrayList() {
        return merchantArrayList;
    }

    public void setMerchantArrayList(ArrayList<Merchant> merchantArrayList) {
        this.merchantArrayList = merchantArrayList;
    }
}
